package com.tjbklx1.dubbo.event;

import java.util.Map;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class EventTest {

	public static void main(String[] args) {

		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { "classpath:consumer.xml" });
		context.start();

		// 事件通知 示例
		EventService eventService = (EventService) context.getBean("eventService");
		NotifyImpl notify = (NotifyImpl) context.getBean("notify");
		int requestId1 = 1;
		Person ret1 = eventService.get(requestId1);
		int requestId2 = 2;
		Person ret2 = eventService.get(requestId2);
		int requestId3 = 3;
		Person ret3 = eventService.get(requestId3);

		System.out.println("查看返回结果：");

		for (Map.Entry<Integer, Person> kv : notify.ret.entrySet()) {
			System.out.println(kv.getValue());
		}

	}
}
